﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Bussiness.Manager;
using Bussiness.Entity;

public partial class Product_Default : MP.Core.Authentication.Page.AuthenticationBase
{
    public Int32 IntIdCat
    {
        get { return !string.IsNullOrEmpty(Request["ID"]) ? Int32.Parse(Request["ID"]) : -1; }
    }

    public Int32 IntIdPro
    {
        get { return !string.IsNullOrEmpty(Request["PRODID"]) ? Int32.Parse(Request["PRODID"]) : -1; }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IntIdPro == -1)
        {

            if (IntIdCat == -1)
                navi.Add("Sản phẩm", "/Product/Default.aspx?t=san-pham", "Sản phẩm", false);
            else
            {
                DataTable dt = CmsCategoryManager.CreateInstant().GetCategoryListByLang("PROD", "vi-VN", IntIdCat);
                if (dt.Rows.Count > 0)
                {
                    navi.Add("Sản phẩm", "/Product/Default.aspx?t=san-pham", "Sản phẩm");
                    navi.Add(dt.Rows[0]["CatName"].ToString(), "/Product/Default.aspx?t=san-pham&ID=" + IntIdCat);
                }
            }
           
        }
        else
        {
            DataTable dtProCat = CmsNewsInfosManager.CreateInstant().getCatIntIdByProIntId(IntIdPro);
            if (dtProCat.Rows.Count > 0)
            {
                Int32 IntIdCat = Int32.Parse(dtProCat.Rows[0]["IntIdCat"].ToString());

                DataTable dt = CmsCategoryManager.CreateInstant().GetCategoryListByLang("PROD", "vi-VN", IntIdCat);
                if (dt.Rows.Count > 0)
                {
                    navi.Add("Sản phẩm", "/Product/Default.aspx?t=san-pham", "Sản phẩm");
                    navi.Add(dt.Rows[0]["CatName"].ToString(), "/Product/Default.aspx?t=san-pham&ID=" + IntIdCat);
                }

            }
        }
        navi.StartBreadcrumb();
        WB.Library.CookieManager.setCookie(Page, "CurrentPage", "liProducts");
    }
}
